import request from '@/utils/request' // 引入创建好的axios对象

// 1.导出用户登录api
export const login = data => {
  return request({
    method: 'POST',
    url: '/app/v1_0/authorizations',
    data
  })
}
// 2.发送短信验证码
export const getSmsCode = mobile => {
  return request({
    method: 'GET',
    url: `/app/v1_0/sms/codes/${mobile}`
  })
}
/**
 * 3.添加关注
 */
export const addFollow = userId => {
  return request({
    method: 'POST',
    url: '/app/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}

/**
 * 4.取消关注
 */
export const deleteFollow = userId => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/user/followings/${userId}`
  })
}
// 5.获取用户信息

export const getuserinfo = () => {
  return request({
    method: 'GET',
    url: '/app/v1_0/user'
  })
}
// 6.获取编辑信息
export const getusereditinfo = () => {
  return request({
    method: 'GET',
    url: '/app/v1_0/user/profile'
  })
}
// 7.更改用户头像
export function updateUserPhoto (data) {
  return request({
    method: 'PATCH',
    url: '/app/v1_0/user/photo',
    data
  })
}
